#define  _CRT_SECURE_NO_WARNINGS 1
#include<iostream>

using namespace std;

//快乐数
class Solution {
public:
    int sum(int n)
    {
        int ans = 0;
        while (n)
        {
            int t = n % 10;
            ans += t * t;
            n /= 10;
        }
        return ans;
    }

    bool isHappy(int n)
    {
        int fast = n;
        int slow = sum(n);
        while (fast != slow)
        {
            fast = sum(fast);
            slow = sum(sum(slow));
        }
        return slow == 1;
    }
};

int main()
{

    return 0;
}